/**
 * 
 */
package com.xb.cloud.product.merchant.service.impl;

import java.math.BigDecimal;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.xb.cloud.common.JsonUtils;
import com.xb.cloud.product.merchant.inner.service.ProductSkuPriceInnerService;
import com.xb.cloud.product.merchant.service.client.ProductSkuPriceService;
import com.xb.cloud.product.merchant.service.client.bo.EndMerchantUserBo;
import com.xb.cloud.service.client.ServiceReturnCodes;
import com.xb.cloud.service.client.ServiceReturnInfo;
import com.xb.cloud.service.client.ServiceReturnUtils;

/**
 * sku价格服务类
 * 
 * @author kexue
 *
 */

@Service
public class ProductSkuPriceServiceImpl extends AbstractService implements ProductSkuPriceService {
	
	private static final Logger LOGGER=LoggerFactory.getLogger(ProductSkuPriceServiceImpl.class);

	@Resource
	private ProductSkuPriceInnerService  productSkuPriceInnerService;
	

	@Override
	public ServiceReturnInfo createSkuPrice(BigDecimal priceMarket, BigDecimal priceSale,Long productId, Long productSkuId,
			EndMerchantUserBo endMerchantUserBo) {

		 Long id = productSkuPriceInnerService.createSkuPrice(priceMarket, priceSale, productId, productSkuId, endMerchantUserBo);
		if (id <= 0) {
			LOGGER.error("插入sku price失败" + JsonUtils.beanToJson(""));
			return ServiceReturnUtils.error(ServiceReturnCodes.SYSTEM_EXCEPTION);
		}
		return ServiceReturnUtils.success(id);

	}

}
